import {defineStore} from "pinia";
import {ElMessage} from "element-plus";
import "@/mock/course/index"
import {searchHeader} from "@/api/course";
import type {HeaderListModel} from "@/mock/course";
interface initHeaderDataModel {
    headerList:HeaderListModel
}

const initHeaderData=():initHeaderDataModel=>({
    headerList:[]
})
export const useCourseStore = defineStore('course', {
        state: () => (initHeaderData()),
        actions:{
           async getHeader(){
               try {
                  let res= await searchHeader()
                   this.headerList=res.data
                   console.log(this.headerList)
               }catch(error){
                   return Promise.reject(error)
               }
           }
        }
    }
)
